<!DOCTYPE html>
<html lang="zh-CN">
<head>
     <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description"content="{{site.description}}">
    <meta name="keywords" content="{{site.keywords}}"/>
    <meta property="og:title" content="{{site.title}}" />
    <meta property="og:description" content="{{site.description}}" />
    <title>{{site.title}}-{{site.name}}</title>
    {{include './common/css.html'}}
    <!-- <script src="js/main.js" defer></script> -->
</head>
<body class="font-sans bg-gray-50">
   {{include './common/header.html'}}
    <!-- 新闻详情内容 -->
    <main class="pt-16 pb-12">
        <div class="max-w-6xl mx-auto px-4 max-w-4xl mt-6">
            <!-- 面包屑导航 -->
            <nav class="text-sm mb-6" aria-label="Breadcrumb">
                <ol class="inline-flex items-center space-x-1 md:space-x-3">
                    <li class="inline-flex items-center">
                        <a href="index.html" class="inline-flex items-center text-gray-700 hover:text-blue-600">
                            <i class="fas fa-home mr-2"></i>
                            首页
                        </a>
                    </li>
                     {{each position}}
                        <li>
                            <div class="flex items-center">
                                <i class="fas fa-chevron-right text-gray-400 mx-2"></i>
                                <a href="{{$value.path}}/index.html" class="text-gray-700 hover:text-blue-600">{{$value.name}}</a>
                            </div>
                        </li>
                        {{/each}}
                   
                    <li aria-current="page">
                        <div class="flex items-center">
                            <i class="fas fa-angle-right text-gray-400 mx-2"></i>
                            <span class="ml-1 text-gray-500 md:ml-2">新闻详情</span>
                        </div>
                    </li>
                </ol>
            </nav>

            <!-- 新闻内容 -->
            <article class="bg-white rounded-lg shadow-md p-8">
                <h1 class="text-2xl md:text-3xl font-bold mb-4">{{article.title}}</h1>
                
                <div class="flex items-center text-gray-500 text-sm mb-6">
                    <time datetime="2023-11-15" class="mr-4"><i class="far fa-calendar-alt mr-1"></i> {{dateFormat(article.updatedAt, 'YYYY-MM-DD')}}</time>
                    <span><i class="far fa-eye mr-1"></i> {{article.pv}}次阅读</span>
                </div>

                <div class="prose max-w-none">
                    {{@ article.content}}
                    </div>

                <!-- 分享按钮 -->
                 
            </article>
            <!-- 上一篇/下一篇 -->
                    <div class="mt-8 grid grid-cols-2 gap-4">
                        {{if pre}}
                            <a href="{{pre.path}}/article-{{pre.id}}.html" class="bg-white rounded-lg shadow-md p-4 hover:shadow-lg transition-shadow">
                                <p class="text-sm text-gray-500 mb-2">上一篇</p>
                                <p class="font-medium">{{pre.title}}</p>
                            </a>
                        {{else}}
                            <div class="bg-white rounded-lg shadow-md p-4 hover:shadow-lg transition-shadow">
                            <p class="text-sm text-gray-500 mb-2">上一篇</p>
                            <p class="font-medium">真的没有了</p>
                        </div>
                        {{/if}}

                        {{if next}}
                            <a href="{{next.path}}/article-{{next.id}}.html" class="bg-white rounded-lg shadow-md p-4 hover:shadow-lg transition-shadow">
                                <p class="text-sm text-gray-500 mb-2">下一篇</p>
                                <p class="font-medium">{{next.title}}</p>
                            </a>
                         {{else}}
                            <div class="bg-white rounded-lg shadow-md p-4 hover:shadow-lg transition-shadow">
                                <p class="text-sm text-gray-500 mb-2">下一篇</p>
                                <p class="font-medium">真的没有了</p>
                            </div>
                        {{/if}}
                    </div>

            <!-- 相关新闻 -->
            <section class="mt-12">
                <h2 class="text-2xl font-bold mb-6">相关新闻</h2>
                <div class="grid md:grid-cols-2 gap-6">
                    {{each imgs}}
                    <article class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
                        <img src="{{$value.img}}" alt="相关新闻" class="w-full h-40 object-cover">
                        <div class="p-4">
                            <h3 class="text-lg font-semibold mb-2">
                                <a href="{{$value.path}}/article-{{$value.id}}.html" class="hover:text-blue-600">{{$value.title}}</a>
                            </h3>
                            <time class="text-gray-500 text-sm"> {{dateFormat($value.createdAt, 'YYYY-MM-DD')}}</time>
                        </div>
                    </article>
                   {{/each}}
                </div>
            </section>
        </div>
    </main>

    {{include './common/footer.html'}}
    {{include './common/js-common.html'}}


    <script>
        // 简单的URL参数解析
        const urlParams = new URLSearchParams(window.location.search);
        const newsId = urlParams.get('id');
        // 实际应用中这里应该根据ID获取新闻数据
    </script>
</body>
</html>